package com.genentech.bioinformatics.mobi;
/*
 * Class by Jeff Milton, except where otherwise noted.
 */
import com.genentech.flexigraph.Grid;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public class GANnotation {

	private boolean highlight = false;
	private boolean select = false;
	private float x = 1f;
	private float y = 1f;
	private float width = 1f;
	private float height = 1f;
	private Paint paint = new Paint();

	public GANnotation() {
		paint.setColor(Color.BLUE);
	}

	public GANnotation(int color) {
		paint.setColor(color);
	}

	public GANnotation(int color, int _x, int _y) {
		x = _x;
		y = _y;
		paint.setColor(color);
	}

	public boolean isInside(float _x, float _y) {
		if (_x > x && _x < (x + width) && (_y > y) && (_y < (y + height))) {
			return true;
		} else
			return false;
	}

	public Paint getPaint() {
		return paint;
	}

	public void draw(Canvas _canvas, Grid _f) {
		if (highlight) {
			_canvas.drawRect(_f.X(x), _f.Y(y), _f.X(x + width),
					_f.Y(y + height), StandardPaints.highlight_paint);
		} else if (select) {
			_canvas.drawRect(_f.X(x), _f.Y(y), _f.X(x + width),
					_f.Y(y + height), StandardPaints.select_paint);
		} else {
			_canvas.drawRect(_f.X(x), _f.Y(y), _f.X(x + width),
					_f.Y(y + height), paint);
		}

	}

	public void highlight() {
		highlight = true;
	}

	public void unhighlight() {
		select = false;
		highlight = false;
	}

	public void select() {
		select = true;
	}

	public float getX() {
		return x;
	}
	public float getY ()
	{
		return y;
		
	}
	public float getWidth ()
	{
		return width;
		
	}
	public float getHeight ()
	{
		return height;
	}
}

